﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace EasySL.Controls
{
    public class ExLinkButton : HyperlinkButton
    {

        #region Url
        /// <summary>
        /// Identifies the Url dependency property.
        /// </summary>
        public static readonly DependencyProperty UrlProperty =
            DependencyProperty.Register("Url",
                typeof(String),
                typeof(ExLinkButton),
                null);

        /// <summary>
        /// Gets or sets Url.
        /// </summary>
        public String Url
        {
            get { return (String)GetValue(UrlProperty); }
            set { SetValue(UrlProperty, value); }
        }
        #endregion                           
     
        public ExLinkButton()
            : base()
        {
            this.Click += new RoutedEventHandler(ExLinkButton_Click);
        }

        void ExLinkButton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(this.Url))
                HtmlPage.Window.Navigate(new Uri(this.Url), "_blank");
        }

 
    }
}
